package com.witdata.common.mapper;

import com.witdata.common.domain.dto.QuestionDto;
import com.witdata.common.domain.dto.SubjectDto;
import com.witdata.mysql.domain.entity.TQuestion;
import com.witdata.mysql.domain.entity.TSubject;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

import java.util.List;

@Mapper
public interface SubjectMapper {
    SubjectMapper INSTANCE = Mappers.getMapper(SubjectMapper.class);

    List<TSubject> toTSubjectList(List<SubjectDto> subjectDtoList);

    List<SubjectDto> toSubjectDtoList(List<TSubject> tSubjectList);

    @Mapping(source = "creator", target = "creator", ignore = true)
    SubjectDto toSubjectDto(TSubject tSubject);

    @Mapping(source = "creator.id", target = "creator", ignore = true)
    TSubject toTSubject(SubjectDto subjectDto);

    QuestionDto toQuestionDto(TQuestion question);

    List<QuestionDto> toQuestionDtoList(List<TQuestion> tQuestionList);

    TQuestion toTQuestion(QuestionDto questionDto);
}
